  // 获取登录信息
  import {
    myRequesy
  } from '../request/api'
  export function getLogin(state) {
    wx.getUserProfile({
      desc: '获取您的用户名和头像',
      success(res1) {
        wx.login({
          success(res2) {
            let userData = {
              code: res2.code,
              nickName: res1.userInfo.nickName,
              avatarUrl: res1.userInfo.avatarUrl
            }
            myRequesy({
              url: 'Login',
              data: userData,
              method: "POST",
            }).then(res => {
              if (res.code === 0) {
                wx.setStorage({
                  data: res.data,
                  key: 'userInfo',
                  success() {
                    wx.navigateTo({
                      url: '/pages/launch/launch',
                    })
                  }
                })
              } else if (res.code === 2001 || res.code === 2002 || res.code === 2003) {
                wx.removeStorage('userInfo')
              }
            })
          }
        })
      }
    })
  }
  export function useShowToast(title) {
    wx.showToast({
      title,
      icon: "none",
      mask: true
    })
  }